<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}记账系统{% endblock %} - Flask Web App</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
    {% block head_extra %}{% endblock %}
</head>
<body>
    <div class="container">
        <header>
            <h1>记账系统</h1>
            <nav>
                <a href="{{ url_for('index') }}" class="{{ 'active' if request.endpoint == 'index' else '' }}">首页/记账</a>
                <a href="{{ url_for('statistics') }}" class="{{ 'active' if request.endpoint == 'statistics' else '' }}">消费统计</a>
            </nav>
        </header>
        
        <hr>

        <main>
            {% with messages = get_flashed_messages(with_categories=true) %}
              {% if messages %}
                <ul class=flashes>
                {% for category, message in messages %}
                  <li class="{{ category }}">{{ message }}</li>
                {% endfor %}
                </ul>
              {% endif %}
            {% endwith %}
            {% block content %}{% endblock %}
        </main>

        <footer>
            <p>&copy; {{ now.year if now else '2024' }} 记账系统. 由 Flask 和 MySQL 驱动.</p>
        </footer>
    </div>
    {% block scripts_extra %}{% endblock %}
</body>
</html>
